\(\int \cot (a+i \log (x)) \, dx\) [189]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 9, antiderivative size = 27 \[ \int \cot (a+i \log (x)) \, dx=-i x+2 i e^{i a} \text {arctanh}\left (e^{-i a} x\right ) \]

[Out]

-I*x+2*I*exp(I*a)*arctanh(x/exp(I*a))

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.444, Rules used = {4588, 381, 396, 213} \[ \int \cot (a+i \log (x)) \, dx=2 i e^{i a} \text {arctanh}\left (e^{-i a} x\right )-i x \]

[In]

Int[Cot[a + I*Log[x]],x]

[Out]

(-I)*x + (2*I)*E^(I*a)*ArcTanh[x/E^(I*a)]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 381

Int[((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[x^(n*(p + q))*(b + a/x^n)^
p*(d + c/x^n)^q, x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IntegersQ[p, q] && NegQ[n]

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 4588

Int[Cot[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Int[((-I - I*E^(2*I*a*d)*x^(2*I*b*d))/(1 - E^(2*I*a
*d)*x^(2*I*b*d)))^p, x] /; FreeQ[{a, b, d, p}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {-i-\frac {i e^{2 i a}}{x^2}}{1-\frac {e^{2 i a}}{x^2}} \, dx \\ & = \int \frac {-i e^{2 i a}-i x^2}{-e^{2 i a}+x^2} \, dx \\ & = -i x-\left (2 i e^{2 i a}\right ) \int \frac {1}{-e^{2 i a}+x^2} \, dx \\ & = -i x+2 i e^{i a} \text {arctanh}\left (e^{-i a} x\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 42, normalized size of antiderivative = 1.56 \[ \int \cot (a+i \log (x)) \, dx=-i x+2 i \text {arctanh}(x \cos (a)-i x \sin (a)) \cos (a)-2 \text {arctanh}(x \cos (a)-i x \sin (a)) \sin (a) \]

[In]

Integrate[Cot[a + I*Log[x]],x]

[Out]

(-I)*x + (2*I)*ArcTanh[x*Cos[a] - I*x*Sin[a]]*Cos[a] - 2*ArcTanh[x*Cos[a] - I*x*Sin[a]]*Sin[a]

Maple [A] (verified)

Time = 0.51 (sec) , antiderivative size = 22, normalized size of antiderivative = 0.81

method result size
risch \(-i x +2 i \operatorname {arctanh}\left (x \,{\mathrm e}^{-i a}\right ) {\mathrm e}^{i a}\) \(22\)

[In]

int(cot(a+I*ln(x)),x,method=_RETURNVERBOSE)

[Out]

-I*x+2*I*arctanh(x*exp(-I*a))*exp(I*a)

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 49 vs. \(2 (17) = 34\).

Time = 0.26 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.81 \[ \int \cot (a+i \log (x)) \, dx=-\sqrt {-e^{\left (2 i \, a\right )}} \log \left (x + i \, \sqrt {-e^{\left (2 i \, a\right )}}\right ) + \sqrt {-e^{\left (2 i \, a\right )}} \log \left (x - i \, \sqrt {-e^{\left (2 i \, a\right )}}\right ) - i \, x \]

[In]

integrate(cot(a+I*log(x)),x, algorithm="fricas")

[Out]

-sqrt(-e^(2*I*a))*log(x + I*sqrt(-e^(2*I*a))) + sqrt(-e^(2*I*a))*log(x - I*sqrt(-e^(2*I*a))) - I*x

Sympy [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.07 \[ \int \cot (a+i \log (x)) \, dx=- i x - \left (i \log {\left (x - e^{i a} \right )} - i \log {\left (x + e^{i a} \right )}\right ) e^{i a} \]

[In]

integrate(cot(a+I*ln(x)),x)

[Out]

-I*x - (I*log(x - exp(I*a)) - I*log(x + exp(I*a)))*exp(I*a)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 94 vs. \(2 (17) = 34\).

Time = 0.21 (sec) , antiderivative size = 94, normalized size of antiderivative = 3.48 \[ \int \cot (a+i \log (x)) \, dx=-{\left (\cos \left (a\right ) + i \, \sin \left (a\right )\right )} \arctan \left (\sin \left (a\right ), x + \cos \left (a\right )\right ) - {\left (\cos \left (a\right ) + i \, \sin \left (a\right )\right )} \arctan \left (\sin \left (a\right ), x - \cos \left (a\right )\right ) - \frac {1}{2} \, {\left (-i \, \cos \left (a\right ) + \sin \left (a\right )\right )} \log \left (x^{2} + 2 \, x \cos \left (a\right ) + \cos \left (a\right )^{2} + \sin \left (a\right )^{2}\right ) - \frac {1}{2} \, {\left (i \, \cos \left (a\right ) - \sin \left (a\right )\right )} \log \left (x^{2} - 2 \, x \cos \left (a\right ) + \cos \left (a\right )^{2} + \sin \left (a\right )^{2}\right ) - i \, x \]

[In]

integrate(cot(a+I*log(x)),x, algorithm="maxima")

[Out]

-(cos(a) + I*sin(a))*arctan2(sin(a), x + cos(a)) - (cos(a) + I*sin(a))*arctan2(sin(a), x - cos(a)) - 1/2*(-I*c
os(a) + sin(a))*log(x^2 + 2*x*cos(a) + cos(a)^2 + sin(a)^2) - 1/2*(I*cos(a) - sin(a))*log(x^2 - 2*x*cos(a) + c
os(a)^2 + sin(a)^2) - I*x

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.19 \[ \int \cot (a+i \log (x)) \, dx=i \, e^{\left (i \, a\right )} \log \left (x + e^{\left (i \, a\right )}\right ) - i \, e^{\left (i \, a\right )} \log \left (-x + e^{\left (i \, a\right )}\right ) - i \, x \]

[In]

integrate(cot(a+I*log(x)),x, algorithm="giac")

[Out]

I*e^(I*a)*log(x + e^(I*a)) - I*e^(I*a)*log(-x + e^(I*a)) - I*x

Mupad [B] (verification not implemented)

Time = 27.23 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.07 \[ \int \cot (a+i \log (x)) \, dx=-x\,1{}\mathrm {i}+\mathrm {atan}\left (\frac {x}{\sqrt {-{\mathrm {e}}^{a\,2{}\mathrm {i}}}}\right )\,\sqrt {-{\mathrm {e}}^{a\,2{}\mathrm {i}}}\,2{}\mathrm {i} \]

[In]

int(cot(a + log(x)*1i),x)

[Out]

atan(x/(-exp(a*2i))^(1/2))*(-exp(a*2i))^(1/2)*2i - x*1i